package com.javabasic.algorithm.leetcode;

import org.checkerframework.checker.units.qual.A;

import java.util.ArrayList;
import java.util.List;

/**
 * @author mir.xiong
 * @version 1.0
 * @description
 * @see
 * @since Created by work on 2023/12/25 20:42
 */
public class NumberOfBurgersWithNoWasteOfIngredients {

    /**
     * 数学题
     * 4x + 2y = A
     * x + y = B
     * 解二元一次方程
     * @param tomatoSlices
     * @param cheeseSlices
     * @return
     */
    public List<Integer> numOfBurgers(int tomatoSlices, int cheeseSlices) {
        if ((tomatoSlices - 2 * cheeseSlices) % 2 == 0) {
            int total_jumbo = (tomatoSlices - 2 * cheeseSlices) / 2;
            int total_small = cheeseSlices - total_jumbo;
            if (total_jumbo >= 0 && total_small >= 0) {
                return new ArrayList<>(){{add(total_jumbo);add(total_small);}};
            }

        }
        return new ArrayList<>();
    }
}
